<?php
/**
 * @copyright	Copyright (C) 2012 ITTWEB. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

/**
 * Add a preview button in article edit form
 */
class plgSystemArticle_preview extends JPlugin
{
	function onContentPrepareForm($form, $data)
	{
		//die($form->getName());
		//$app =& JFactory::getApplication();
		//die($app->getName());
		//die($app->isAdmin());
		$this->loadLanguage('plg_system_article_preview');
		if ($form->getName() == 'com_content.article' && !empty($data->id)) {;
			$itemid = $this->params->get('itemid', 0);
			$bar = JToolBar::getInstance('toolbar');
			$bar->appendButton('Popup', 'preview', 'PLG_ARTICLE_PREVIEW_PREVIEW', '../index.php?option=com_content&view=article&id='.$data->id.'&Itemid='.$itemid, 900, 600);
		}
	}
}
